<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\blog\model;
use think\Model;
use think\Db;
class StorecatModel extends Model
{
    protected $table = 'mt_store';
    public function brand($where="")
    {
        $array=DB::name('brand')->where($where)->paginate(10);
        return $array;
    }
    /*
     * 更新商品表
     * */
    public function goods($goods,$store)
    {
        $good=array();
        foreach($goods as $k=>$v)
        {
            $good[$k]['g_id']=$store.$v['g_id'].rand(100,999);
            $good[$k]['g_tableid']=$v['g_id'];
            $good[$k]['g_goodsname']=$v['g_goodsname'];
            $good[$k]['g_pic']=$v['g_pic'];
            $good[$k]['g_format']=$v['g_format'];
            $good[$k]['g_price']=$v['g_price'];
            $good[$k]['g_category']=$v['g_category'];
            $good[$k]['g_vipprice']=$v['g_vipprice'];
            $good[$k]['g_status']=$v['g_status'];
            $good[$k]['g_ctime']=$v['g_ctime'];
            $good[$k]['g_utime']=$v['g_utime'];
            $good[$k]['num']=$v['num'];
            $good[$k]['storeid']=$store;
            $good[$k]['brandid']=$v['brandid'];
        }
        $res=DB::name('goods')->insertAll($good);
        return $res;
    }
}